package com.franz.noteapp.room.operation

import com.franz.noteapp.bean.NoteBean
import com.franz.noteapp.room.dao.NoteDao
import com.franz.noteapp.room.repository.NoteRepository
import kotlinx.coroutines.flow.Flow
/**
 * 笔记数据库实际操作类*/
class NoteRepositoryImpl(private val dao: NoteDao):NoteRepository {
    override fun getNotes(): Flow<List<NoteBean>> {
        return dao.queryAll()
    }

    override suspend fun getNote(id: Int): NoteBean? {
        return dao.queryById(id)
    }

    override suspend fun insertNote(bean: NoteBean) {
        dao.insertNote(bean)
    }

    override suspend fun deleteNote(bean: NoteBean) {
        dao.deleteNote(bean)
    }
}